import styled from "styled-components";
import testIcon3 from "../../assets/testIconpng3.png";
import macPc from "../../assets/mac-bg.png";
import { Button, Carousel } from "antd";
import {
  HeartOutlined,
  QqOutlined,
  ShareAltOutlined,
  LikeOutlined,
  WechatOutlined,
} from "@ant-design/icons";
import { useRef, useEffect, useState } from "react";
const Header = styled.div`
  height: 64px;
  width: 100%;
  background: white;
  position: sticky;
  top: 64px;
  box-shadow: 0 20px 30px 0 rgba(0, 0, 0, 0.15);
  display: flex;
  justify-content: space-between;
  padding: 0 50px;
  z-index: 9;
  .headerLeft {
    display: flex;
    align-items: center;
    height: 100%;
    img {
      width: 50px;
      height: 50px;
    }
    p {
      display: inline-block;
      vertical-align: middle;
      font-size: 18px;
      overflow: hidden;
      white-space: nowrap;
      -o-text-overflow: ellipsis;
      text-overflow: ellipsis;
      margin-left: 10px;
      max-width: 88%;
    }
  }
  .headerRight {
    display: flex;
    align-items: center;
    height: 100%;
    .nav {
      font-size: 18px;
      margin-right: 30px;
      color: #1677ff;
    }
  }
`;

const BannerContent = styled.div`
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 50px 0px;
  background: linear-gradient(60deg, #abecd6 0%, #fbed96 100%);
  .leftContent {
    img {
      width: 100px;
      height: 100px;
    }
    h1 {
      font-size: 22px;
      line-height: 1.6em;
      max-height: 3.2em;
      overflow: hidden;
    }
    .version {
      font-size: 14px;
      margin: 15px 0;
    }
    .tags {
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      -ms-flex-wrap: wrap;
      flex-wrap: wrap;
      max-width: 400px;
      .tag {
        width: auto;
        height: 30px;
        line-height: 30px;
        border-radius: 5px;
        background-color: rgba(255, 255, 255, 0.3);
        padding: 0 12px;
        margin-right: 10px;
        margin-bottom: 10px;
        font-size: 14px;
        border: none;
      }
    }
    .btn-wrapper {
      display: flex;
      align-items: center;
      margin-top: 40px;
      .action {
        margin-left: 40px;
        .icon {
          padding: 0 10px;
        }
      }
    }
  }
  .rightContent {
    position: relative;
    img {
      width: 650px;
      height: 400px;
    }
    .ant-carousel {
      position: absolute;
      top: 49px;
      left: 62px;
      width: 530px;
      height: 400px;
    }
  }
`;

const Container = styled.div`
  background: white;
  margin: 0 auto;
  width: 1200px;
  p {
    margin: 20px 0;
    line-height: 40px;
    color: #666;
    font-size: 16px;
  }
`;

const LeftFixed = styled.div`
  width: 50px;
  position: fixed;
  top: 200px;
  left: 50px;
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  img {
    width: 50px;
    height: 50px;
    margin-bottom: 15px;
  }
  .iconWrap {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    height: 100px;
    justify-content: space-around;
  }
`;

const tags = [
  {
    key: 1,
    label: "1.4GB",
  },
  {
    key: 2,
    label: "2024.12.24",
  },
  {
    key: 3,
    label: "100积分",
  },
  {
    key: 4,
    label: "英文软件",
  },
  {
    key: 5,
    label: "国外软件",
  },
  {
    key: 7,
    label: "MacOs 15.x,Mac OS 14.x",
  },
];

const contentStyle = {
  margin: 0,
  height: "300px",
  color: "#fff",
  lineHeight: "160px",
  textAlign: "center",
  background: "#364d79",
};
export default function AppDetailPage() {
  const [showHeader, setShowHeader] = useState(false);
  useEffect(() => {
    window.scrollTo(0, 0);
    const scrollEvent = () => {
      let scrollTop = window.pageYOffset || document.documentElement.scrollTop;
      if (scrollTop >= 500) {
        setShowHeader(true);
      }
      if (scrollTop < 500) {
        setShowHeader(false);
      }
    };
    window.addEventListener("scroll", scrollEvent);
    return () => {
      window.removeEventListener("scroll", scrollEvent);
    };
  }, []);
  return (
    <div className="appDetailPage">
      {showHeader && (
        <Header>
          <div className="headerLeft">
            <img src={testIcon3} alt="" />
            <p>Arturia Augmented MALLETS for mac(槌击乐音源) v1.0.0激活版</p>
          </div>
          <div className="headerRight">
            <span className="nav">内容介绍</span>
            <Button type="primary" size="large">
              下载
            </Button>
          </div>
        </Header>
      )}
      {showHeader && (
        <LeftFixed>
          <img src={testIcon3} alt="" />
          <Button type="primary">下载</Button>
          <div className="iconWrap">
            <HeartOutlined style={{ fontSize: "24px", color: "#999999" }} />
            <ShareAltOutlined style={{ fontSize: "24px", color: "#1398FF" }} />
            <LikeOutlined style={{ fontSize: "24px", color: "#FF9B19" }} />
          </div>
        </LeftFixed>
      )}
      <BannerContent>
        <div className="leftContent">
          <img src={testIcon3} alt="" />
          <h1>Arturia Augmented MALLETS for mac(槌击乐音源)</h1>
          <p className="version">v1.0.0激活版</p>
          <div className="tags">
            {tags.map((item, index) => {
              return (
                <span className="tag" key={item.key}>
                  {item.label}
                </span>
              );
            })}
          </div>
          <div className="btn-wrapper">
            <Button type="primary" size="large">
              立即下载
            </Button>
            <div className="action">
              <span className="icon">
                <HeartOutlined style={{ fontSize: "24px", color: "white" }} />
              </span>
              <span className="icon">
                <ShareAltOutlined
                  style={{ fontSize: "24px", color: "white" }}
                />
              </span>
              <span className="icon">
                <LikeOutlined style={{ fontSize: "24px", color: "white" }} />
              </span>
              <span className="icon">
                <QqOutlined style={{ fontSize: "24px", color: "white" }} />
              </span>
              <span className="icon">
                <WechatOutlined style={{ fontSize: "24px", color: "white" }} />
              </span>
            </div>
          </div>
        </div>
        <div className="rightContent">
          <img src={macPc} alt="" />
          <Carousel arrows infinite={false}>
            <div>
              <h3 style={contentStyle}>1</h3>
            </div>
            <div>
              <h3 style={contentStyle}>2</h3>
            </div>
            <div>
              <h3 style={contentStyle}>3</h3>
            </div>
            <div>
              <h3 style={contentStyle}>4</h3>
            </div>
          </Carousel>
        </div>
      </BannerContent>
      <Container>
        <h3>软件介绍</h3>
        <p>
          Arturia Augmented MALLETS for mac一款现代风格的槌击乐音源插件，Arturia
          Augmented MALLETS
          破解版融合了马林巴琴、颤音琴和钢片琴的打击与和声韵味的尖端软件乐器，为你的创作注入真实、混合与现代的音色魅力。
          Arturia Augmented MALLETS for mac一款现代风格的槌击乐音源插件，Arturia
          Augmented MALLETS
          破解版融合了马林巴琴、颤音琴和钢片琴的打击与和声韵味的尖端软件乐器，为你的创作注入真实、混合与现代的音色魅力。
          Arturia Augmented MALLETS for mac一款现代风格的槌击乐音源插件，Arturia
          Augmented MALLETS
          破解版融合了马林巴琴、颤音琴和钢片琴的打击与和声韵味的尖端软件乐器，为你的创作注入真实、混合与现代的音色魅力。
          Arturia Augmented MALLETS for mac一款现代风格的槌击乐音源插件，Arturia
          Augmented MALLETS
          破解版融合了马林巴琴、颤音琴和钢片琴的打击与和声韵味的尖端软件乐器，为你的创作注入真实、混合与现代的音色魅力。
          Arturia Augmented MALLETS for mac一款现代风格的槌击乐音源插件，Arturia
          Augmented MALLETS
          破解版融合了马林巴琴、颤音琴和钢片琴的打击与和声韵味的尖端软件乐器，为你的创作注入真实、混合与现代的音色魅力。
          Arturia Augmented MALLETS for mac一款现代风格的槌击乐音源插件，Arturia
          Augmented MALLETS
          破解版融合了马林巴琴、颤音琴和钢片琴的打击与和声韵味的尖端软件乐器，为你的创作注入真实、混合与现代的音色魅力。
        </p>
        <h3>安装教程</h3>
        <p>
          Arturia Augmented
          MALLETS破解版下载完成后打开，双击.pkg文件根据安装器提示进行安装
        </p>
        <h3>功能特色</h3>
        <p>
          动态混合槌乐器 每个预设内有两个声音层；每层两个声源 详细的槌乐器样本库
          马林巴琴、颤音琴和钢片琴 纯净、弓弦和准备好的演奏法
          采用硬币、阻尼、颤音等多种技巧的高质量录音 变形控制在 A 层和 B
          层之间移动，每个预设影响最多 8 个参数 七个附加宏：时间、颜色、运动、FX
          A、FX B、混响、延迟 包含 50 个工厂预设
        </p>
        <h3>系统需求</h3>
        <p>
          Mac 操作系统 11+ 4 GB 内存 4 核 CPU，3.4 GHz（4.0 GHz Turbo-boost）或
          M1 CPU 1.5GB可用硬盘空间 OpenGL 2.0 兼容 GPU
        </p>
      </Container>
    </div>
  );
}
